package com.ydh.company.exception;

import com.ydh.company.dto.ResponseData;
import com.ydh.company.dto.ResultData;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author:wkl
 * @Date: 2020/4/23 21:49
 * @Version 0.0.1-SNAPSHOT
 */

@RestControllerAdvice
public class ShiroExceptionHandler {

    /**
     * 捕获没有权限的异常
     * @param e
     * @return
     */
    @ExceptionHandler(AuthorizationException.class)
    ResultData authorizationException(AuthorizationException e){
        return ResponseData.error(9527,"对不起，你没有对应的权限");
    }
}
